var http = require('./httputils'); //相对路径
var config = require("./config")

const server = {
  //微信登录
  weChatLogin: function (params, onSuccess, onFailed) {
    http.postRequest(config.url + "/user/weChatLogin", params, onSuccess, onFailed)
  },
  //设置用户头像
  updateImage: function (params, onSuccess, onFailed) {
    http.postRequest(config.url + "/user/updateImage", params, onSuccess, onFailed)
  },
  //绑定个手机号
  weChatUpdatePhone: function (params, onSuccess, onFailed) {
    http.postRequest(config.url + "/user/weChatUpdatePhone", params, onSuccess, onFailed)
  },
  //获取已经加入的培训列表
  getJoinTraining: function (params, onSuccess, onFailed) {
    http.getRequest(config.url + "/train/getJoinTraining", params, onSuccess, onFailed)
  },
  //获取七牛云上传token
  getUpToken: function (params, onSuccess, onFailed) {
    http.getRequest(config.url + "/file/getUpToken", params, onSuccess, onFailed)
  },
  // 获取用户信息
  userInfo: function (params, onSuccess, onFailed) {
    http.getRequest(config.url + "/user/userInfo", params, onSuccess, onFailed)
  },
  //实名认证
  userAttestation: function (params, onSuccess, onFailed) {
    http.postRequest(config.url + "/user/userAttestation", params, onSuccess, onFailed)
  },
  //设置用户身份证正反面
  setIdPhoto: function (params, onSuccess, onFailed) {
    http.postRequest(config.url + "/user/setIdPhoto", params, onSuccess, onFailed)
  },
  //设置用户证件照
  setPhoto: function (params, onSuccess, onFailed) {
    http.getRequest(config.url + "/user/setPhoto", params, onSuccess, onFailed)
  },
  //我的证书
  myProve: function (params, onSuccess, onFailed) {
    http.getRequest(config.url + "/train/myProve", params, onSuccess, onFailed)
  },
  //获取培训目录（当天的培训内容）
  getTrainDirectory: function (params, onSuccess, onFailed) {
    http.getRequest(config.url + "/train/getTrainDirectory", params, onSuccess, onFailed)
  },
  //获取视频得详细信息
  getTrainData: function (params, onSuccess, onFailed) {
    http.getRequest(config.url + "/train/getTrainData", params, onSuccess, onFailed)
  },
  //提交选项
  submitResult: function (params, onSuccess, onFailed) {
    http.postRequest(config.url + "/train/submitResult", params, onSuccess, onFailed)
  },
  //获取验证码
  getVerificationCode: function (params, onSuccess, onFailed) {
    http.postRequest(config.url + "/user/getVerificationCode", params, onSuccess, onFailed)
  },
  //修改手机号
  updateTelphone: function (params, onSuccess, onFailed) {
    http.postRequest(config.url + "/user/updateTelphone", params, onSuccess, onFailed)
  },
  //提交建议反馈
  feedback: function (params, onSuccess, onFailed) {
    http.postRequest(config.url + "/feedback/feedback", params, onSuccess, onFailed)
  },
  // 记录视频播放信息
  uploadingVideoProgress: function (params, onSuccess, onFailed) {
    http.postRequest(config.url + "/train/uploadingVideoProgress", params, onSuccess, onFailed)
  },
  // 抓拍图片
  faceAuth: function (params, onSuccess, onFailed) {
    http.postRequest(config.url + "/train/faceAuth", params, onSuccess, onFailed)
  },
 //获取证件照列表
 getPhoto: function (params, onSuccess, onFailed) {
  http.getRequest(config.url + "/temporary/getPhoto", params, onSuccess, onFailed)
},
//上传证件照
temporaryUploading:function(params, onSuccess, onFailed) {
  http.postRequest(config.url + "/temporary/uploading", params, onSuccess, onFailed)
},
//删除证件照
deletePhoto:function(params, onSuccess, onFailed) {
  http.postRequest(config.url + "/temporary/deletePhoto", params, onSuccess, onFailed)
},

//重新绑定 手机号的 微信 openid
updateAccount:function(params, onSuccess, onFailed) {
  http.postRequest(config.url + "/user/updateAccount", params, onSuccess, onFailed)
},
//重新绑定 手机号的 微信 openid
videoSave:function(params, onSuccess, onFailed) {
  http.postRequest(config.url + "/train/startEndVideo", params, onSuccess, onFailed)
},
//上报视频进度
sumbituploadingVideoProgress: function (params, onSuccess, onFailed) {
  http.postRequest(config.url + "/train/uploadingVideoProgress", params, onSuccess, onFailed)
},
// 获取未完成的小节
getLastTrainDirectory:function(params, onSuccess, onFailed){
  http.getRequest(config.url + "/train/getLastTrainDirectory", params, onSuccess, onFailed)
}

}
module.exports = {
  http: server,
}